import Vue from 'vue'
import Router from 'vue-router'

// 1. 定义 (路由) 组件。
// 可以从其他文件 import 进来
import HelloWorld from '../components/HelloWorld.vue'
import custom from '../components/custom.vue'
import home from '../components/home.vue'
import props from '../components/props.vue'
import emit from '../components/emit.vue'
import root from '../components/root.vue'
import parent from '../components/parent.vue'
import provide from '../components/provide.vue'
import note from '../components/note.vue'
// 2. 定义路由
// 每个路由应该映射一个组件。 其中"component" 可以是
// 通过 Vue.extend() 创建的组件构造器，
// 或者，只是一个组件配置对象。
// 我们晚点再讨论嵌套路由。
const routes = [
    { path: '*', component: HelloWorld },
    { path: '/home', component: home },
    { path: '/HelloWorld', component: HelloWorld },
    { path: '/custom', component: custom },
    { path: '/props', component: props },
    { path: '/emit', component: emit },
    { path: '/root', component: root },
    { path: '/parent', component: parent },
    { path: '/provide', component: provide },
    { path: '/note', component: note },

]

Vue.use(Router)
export default new Router({
    mode: 'history',//history hash  abstract
    routes // (缩写) 相当于 routes: routes
  })